package com.michau.testitas.app.init;

import com.michau.testitas.common.model.user.User;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;
import org.hibernate.classic.Session;
import org.hibernate.mapping.PersistentClass;
import org.springframework.context.support.FileSystemXmlApplicationContext;

import java.util.Date;

/**
 * User: michau
 * Date: 2/11/13
 * Time: 1:53 PM
 */
public class Main {
    public static void main(String[] args){

        FileSystemXmlApplicationContext ctx = new FileSystemXmlApplicationContext("/modules/app/init/src/main/resources/META-INF/ctx/spring-config.xml");

//        Configuration configuration = new Configuration();
//        configuration.configure();
//        while (configuration.getClassMappings().hasNext()){
//            System.out.print(configuration.getClassMappings().next().getClassName());
//        }
//        SessionFactory sessionFactory = configuration.buildSessionFactory();
//        User user = new User();
//        user.setDateCreated(new Date());
//        user.setFirstname("Michal");
//        user.setLastname("Pleszczynski");
//        user.setLogin("mpleszcz");
//        user.setPassword("pass");
//        user.setTransferKey("asgfhghgdhgfdshtfysdtrtfdg346");
//        Session session = sessionFactory.openSession();
//        Transaction tx = session.beginTransaction();
//        session.save(user);
//        tx.commit();
//        session.close();
    }
}
